<template>
	<view style="height: 100vh;position: relative;background-color: #F6FAFA;">
		<radio-group @change="radioChange">
		<view class="top-address">
			<view style="width: calc( 100vw - 150rpx );">
				<view style="font-size: 35rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 100%;">系统推荐药房<text style="color: #F28C87;">({{medOfficinaInfoName}})</text></view>
				<view style="margin-top: 20rpx;">根据患者的地址遵循就近和有货原则推荐</view>
			</view>
			<view>
				<radio value="1" :checked="yfType==1" @click.stop="" style="transform:scale(0.8);" color="#F28C87"/>
			</view>
		</view>
		<view class="top-address" style="margin-top: 20rpx;" @click="tozd">
			<view style="width: calc( 100vw - 150rpx );">
				<view style="font-size: 35rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 100%;">
					{{selYfMc}}
				</view>
				<view style="margin-top: 20rpx;font-size: 25rpx;">进入地图选择药房，部分药房可能存在药品不齐的情况</view>
			</view>
			<view>
				<radio value="2" :checked="yfType==2" @click.stop="" style="transform:scale(0.8);" color="#F28C87"/>
			</view>
		</view>
		</radio-group>
		<view style="width: 100%;position: fixed;bottom: 40rpx;display: flex;align-items: center;justify-content: space-around;">
			<view class="add-btn" @click="tochufangBuy">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				istj:true,
				iszd:false,
				medOfficinaInfoName:'',
				medOfficinaInfoId:'',
				recipeId:'',
				doctorNormalRecipeDrug:'',
				usrUserId:undefined,
				selYfId:undefined,
				selYfMc:'我要指定药房',
				yfType: 1
			};
		},
		onLoad(options) {
			this.medOfficinaInfoName = options.medOfficinaInfoName
			this.medOfficinaInfoId = options.medOfficinaInfoId
			this.recipeId = options.recipeId
			this.doctorNormalRecipeDrug = options.doctorNormalRecipeDrug
			this.usrUserId = options.usrUserId
		},
		// watch:{
		// 	istj(nv){
		// 		if(nv){
		// 			this.iszd = false
		// 		}
		// 	},
		// 	iszd(nv){
		// 		if(nv){
		// 			this.istj = false
		// 		}
		// 	}
		// },
		methods: {
			radioChange(evt){
				this.yfType = evt.detail.value
			},
			tozd(){
				let param = 'usrUserId='+this.usrUserId
				uni.navigateTo({
				    url: '/pages3/zdyf/index?'+param
				});
			},
			tochufangBuy(){
				let param = ''
				if(this.yfType == 2 && !this.selYfId){
					uni.showToast({
						title: '未选择指定的药房！'
					})
					return
				}
				if(this.yfType == 2 && this.selYfId){
					param += 'medOfficinaInfoId='+this.selYfId
					param += '&medOfficinaInfoName='+this.selYfMc
				}else{
					param += 'medOfficinaInfoId='+this.medOfficinaInfoId
					param += '&medOfficinaInfoName='+this.medOfficinaInfoName
				}
				param += '&doctorNormalRecipeDrug='+this.doctorNormalRecipeDrug
				param += '&recipeId='+this.recipeId
				param += '&usrUserId='+this.usrUserId
				console.log(param)
				uni.navigateTo({
				    url: '/pages3/chufangbuy/index?'+param
				});
			}
		}
	};
</script>

<style lang="less">
	.top-address{
		padding-left: 40rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #FFFFFF;
		padding: 40rpx;
	}
	.add-btn{
		margin: auto;
		height: 88rpx;
		line-height: 88rpx;
		width: 90%;
		background: linear-gradient(90deg, #F1BAB2 0%, #F78D7D 100%);
		box-shadow: 0px 20rpx 25rpx 0px rgba(247,141,125,0.4);
		border-radius: 44rpx;
		color: #FFFFFF;
		text-align: center;
	}
</style>
